<template>
    <el-container class="image" :style="{ height: h + 'px' }">
        <el-header class="imageHeader">
            <el-button type="primary" size="small" @click="handleOpenCreate">新增图片分类</el-button>
            <el-button type="warning" size="small" @click="handleOpenUpload">上传图片</el-button>
        </el-header>
        <el-container>
            <ImageAside ref="imageAsideRef" @change="handleAsideChange"></ImageAside>
            <ImageMain ref="ImageMainRef"></ImageMain>
        </el-container>
    </el-container>
</template>
<script setup>
import { ref } from 'vue'
import ImageAside from './components/ImageAside.vue'
import ImageMain from './components/ImageMain.vue'

const windowHeight = window.innerHeight || document.body.clientHeight
const h = windowHeight - 64 - 44 - 40

const imageAsideRef = ref(null)
const handleOpenCreate = () => imageAsideRef.value.handleCreate()

const ImageMainRef = ref(null)

// 列表对应图库切换
const handleAsideChange = (id) => {
    ImageMainRef.value.loadData(id)
}

const handleOpenUpload = () => ImageMainRef.value.openUploadFile()
</script>
<style scoped lang="less">
.image {
    background-color: #fff;
    border-radius: 5px;

    .imageHeader {
        display: flex;
        align-items: center;
        border-bottom: 1px solid #eeeeee;
    }


}
</style>